﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Insert_ShoppingCart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void AddShoppingcart(object s, EventArgs e)
    {
        ShoppingCart sh = new ShoppingCart();
        ShoppingCartBOL sBOL = new ShoppingCartBOL();
        try
        {
            sh.ShoppingID = txtShoppingID.Text;
            sh.ProID = txtProductID.Text;
            sh.Identification = txtIdentification.Text;
            sh.Quantity = Convert.ToInt32(txtQuantity.Text);
            sh.DateShopping = DateTime.Now;
            sh.TotalPrice = Convert.ToDouble(txtTotalPrice.Text);
            sh.Status = DropDownList1.SelectedItem.ToString();

            int result = sBOL.insertShoppingcart(sh);
            if (result > 0)
            {
                Label9.Text = "Insert record is successful!";
            }
            else
                Label9.Text = "Insert record is error";
        }
        catch (Exception ex)
        {
            Label9.Text = ex.Message;
        }
        finally
        {
            sh = null;
            sBOL = null;
        }
    }
}